/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.yonsei.iwb.smarttv.util;

import java.io.OutputStream;

/**
 *
 * @author Onlyjiny
 */
public class SMARTTVLog {

    public static final int NON = 0;
    public static final int BASIC = 1;
    public static final int DEFAULT = 2;
    public static final int DETAIL = 3;

    private static int level = 0;
    private static OutputStream target = System.out;

    public static void setLogType(int level) {
        SMARTTVLog.level = level;
    }
    
    public static void setTarget(OutputStream os) {
        SMARTTVLog.target = os;
    }

    public static void log(int level, String s) {
        if(SMARTTVLog.level >= level) {
            try {
                SMARTTVLog.target.write(s.getBytes());
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    }

    public static void log(int level, StringBuffer sb) {
        SMARTTVLog.log(level, sb.toString());
    }

}
